# coding: utf-8 or # -*- coding: utf-8 -*-

##传入对象返回字典
def row3dict(row):
    d = {}
    if hasattr(row, '__table__'):
        for column in row.__table__.columns:
            d[column.name] = str(getattr(row, column.name))
    else:
        pass
    # 处理result问题#处理result
    return d

##将modoe转换成[{}]
def ret_json(obj):
    dt_s = []
    for u in obj:
        # print type(u)
        # print dir(u)
        dt_s.append(row3dict(u))
        return dt_s
